package com.sc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sc.mapper.HuserMapper;
import com.sc.mapper.TuserMapper;
import com.sc.pojo.Huser;
import com.sc.pojo.Trolemenu;
import com.sc.pojo.Tuser;
import com.sc.service.TuserService;
import com.sc.util.MybatisUtil;

import java.util.List;

public class TuserServiceImpl implements TuserService {
    @Override
    public PageInfo<Tuser> show(Integer pageNum, Integer pageSize) {
        //1.先设置分页  必须写在查询前面  否则会失效
        PageHelper.startPage(pageNum, pageSize);
        //2.封装PageInfo对象  借助于有参构造（表中的所有数据）
        //2.获取Huser所有数据  分页插件会帮你  做limit分页
        TuserMapper mapper = MybatisUtil.getMapper(TuserMapper.class);
        List<Tuser> list = mapper.selectAll();
        PageInfo<Tuser> p = new PageInfo<>(list);
        MybatisUtil.close();
        return p;
    }
}
